using System;
using System.Collections.Generic;
using System.Text;
using SDMX_Common = SDMX_ML.Framework.Common;

namespace SDMX_ML.Framework.Structure
{
    public class DimensionType
    {
        //Elements
        private List<TextFormatType> _textformat;
        private SDMX_Common.AnnotationsType _annotations;

        //Attributes
        private SDMX_Common.IDType _conceptref; //required
        private SDMX_Common.IDType _conceptagency;
        private string _conceptversion;
        private SDMX_Common.IDType _conceptSchemeRef;
        private SDMX_Common.IDType _codelist;
        private string _codeListVersion;
        private SDMX_Common.IDType _codeListAgency;
        private SDMX_Common.IDType _conceptSchemeAgency;
        private bool? _isMeasureDimension;
        private bool? _isFrequencyDimension;
        private bool? _isEntityDimension;
        private bool? _isCountDimension;
        private bool? _isNonObservationTimeDimension;
        private bool? _isIdentityDimension;
        private bool? _crossSectionalAttachDataSet;
        private bool? _crossSectionalAttachGroup;
        private bool? _crossSectionalAttachSection;
        private bool? _crossSectionalAttachObservation;

        public DimensionType(SDMX_Common.IDType conceptRef)
        {
            if (conceptRef != null)
            {
                _conceptref = conceptRef;
            }
            else
            {
                throw new Exception("Attribute ConceptRef is a required field.");
            }
        }

        public DimensionType(SDMX_Common.IDType conceptRef, SDMX_Common.IDType codelist)
        {
            if (conceptRef != null)
            {
                _conceptref = conceptRef;
            }
            else
            {
                throw new Exception("Attribute ConceptRef is a required field.");
            }

            if (codelist != null)
            {
                _codelist = codelist;
            }
        }

        public DimensionType(string conceptRef)
        {
            if (!String.IsNullOrEmpty(conceptRef))
            {
                _conceptref = new SDMX_Common.IDType(conceptRef);
            }
            else
            {
                throw new Exception("Attribute ConceptRef is a required field.");
            }
        }

        public DimensionType(string conceptRef, string codelist)
        {
            if (!String.IsNullOrEmpty(conceptRef))
            {
                _conceptref = new SDMX_Common.IDType(conceptRef);
            }
            else
            {
                throw new Exception("Attribute ConceptRef is a required field.");
            }

            if (!String.IsNullOrEmpty(codelist))
            {
                _codelist = new SDMX_Common.IDType(codelist);
            }
        }

        public List<TextFormatType> TextFormat
        {
            get { return _textformat; }
            set 
            {
                if (_textformat == null)
                {
                    _textformat = new List<TextFormatType>();
                }

                _textformat = value; 
            }
        }

        public SDMX_Common.AnnotationsType Annotations
        {
            get { return _annotations; }
            set {  _annotations = value; }
        }

        public SDMX_Common.IDType Conceptref
        {
            get { return _conceptref; }
            set { _conceptref = value; }
        }

        public SDMX_Common.IDType ConceptAgency
        {
            get { return _conceptagency; }
            set { _conceptagency = value; }
        }

        public string ConceptVersion
        {
            get { return _conceptversion; }
            set { _conceptversion = value; }
        }

        public SDMX_Common.IDType ConceptSchemeRef
        {
            get { return _conceptSchemeRef; }
            set { _conceptSchemeRef = value; }
        }
        
        public SDMX_Common.IDType Codelist
        {
            get { return _codelist; }
            set { _codelist = value; }
        }

        public string CodeListVersion
        {
            get { return _codeListVersion; }
            set { _codeListVersion = value; }
        }

        public SDMX_Common.IDType CodeListAgency
        {
            get { return _codeListAgency; }
            set { _codeListAgency = value; }
        }

        public SDMX_Common.IDType ConceptSchemeAgency
        {
            get { return _conceptSchemeAgency; }
            set { _conceptSchemeAgency = value; }
        }

        public bool? IsMeasureDimension
        {
            get { return _isMeasureDimension; }
            set { _isMeasureDimension = value; }
        }

        public bool? IsFrequencyDimension
        {
            get { return _isFrequencyDimension; }
            set { _isFrequencyDimension = value; }
        }

        public bool? IsEntityDimension
        {
            get { return _isEntityDimension; }
            set { _isEntityDimension = value; }
        }

        public bool? IsCountDimension
        {
            get { return _isCountDimension; }
            set { _isCountDimension = value; }
        }

        public bool? IsNonObservationTimeDimension
        {
            get { return _isNonObservationTimeDimension; }
            set { _isNonObservationTimeDimension = value; }
        }

        public bool? IsIdentityDimension
        {
            get { return _isIdentityDimension; }
            set { _isIdentityDimension = value; }
        }

        public bool? CrossSectionalAttachDataSet
        {
            get { return _crossSectionalAttachDataSet; }
            set { _crossSectionalAttachDataSet = value; }
        }

        public bool? CrossSectionalAttachGroup
        {
            get { return _crossSectionalAttachGroup; }
            set { _crossSectionalAttachGroup = value; }
        }

        public bool? CrossSectionalAttachSection
        {
            get { return _crossSectionalAttachSection; }
            set { _crossSectionalAttachSection = value; }
        }

        public bool? CrossSectionalAttachObservation
        {
            get { return _crossSectionalAttachObservation; }
            set { _crossSectionalAttachObservation = value; }
        }

    }
}
